Skip to content

fix(devframe): dedupe RPC augmentation interfaces in published dist#21

Merged
antfu merged 1 commit into
mainfrom
antfu/update-docs
May 21, 2026
Merged

fix(devframe): dedupe RPC augmentation interfaces in published dist#21
antfu merged 1 commit into
mainfrom
antfu/update-docs

Conversation

@antfu
Copy link
Copy Markdown
Contributor

@antfu antfu commented May 21, 2026

Summary

  • The dual tsdown configs (browser + node) each ran an independent rolldown chunk graph, so src/types/rpc-augments.ts was inlined into a per-build shared dts chunk and DevToolsRpc* interfaces were declared twice in dist/; consumer declare module 'devframe' augmentations only merged into one copy, leaving import chains that reached the other un-augmented (TS2345 downstream in vitejs/devtools).
  • Restructure tsdown.config.ts into three configs — keep the client/server runtime split for chunk-graph isolation (now dts: false) and add a combined emitDtsOnly: true dts build that processes every entry through one rolldown graph, so each augmentable interface has exactly one declaration site.
  • Add a regression test at packages/devframe/test/dts-dedupe.test.ts and document the declare module 'devframe' augmentation pattern (DevToolsRpcServerFunctions / DevToolsRpcClientFunctions in docs/guide/rpc.md, DevToolsRpcSharedStates in docs/guide/shared-state.md).

Test plan

  • pnpm build — succeeds with no rpc-augments-<hash>.d.mts duplication
  • pnpm test — 320/320 pass (incl. new dedupe regression); one tsnapi snapshot updated (ws-client.snapshot.d.ts) reflecting re-export form, symbol surface unchanged
  • pnpm lint and pnpm typecheck — clean
  • Cross-validate against vitejs/devtools on antfu/devframe-v0.4.0 once a release containing the fix is cut: patches/devframe@0.4.0.patch should drop and the TS2345 errors in packages/{rolldown,self-inspect,vite} should disappear

The dual tsdown configs (browser + node) each emitted their own copy of
the `DevToolsRpc*` interfaces into a shared dts chunk, so consumer
`declare module 'devframe'` augmentations only merged into one copy and
left other import chains un-augmented. Add a combined `emitDtsOnly` dts
build that runs every entry through a single rolldown graph so the
augmentable interfaces have exactly one declaration site, plus a
regression test and docs for the augmentation pattern.
Copilot AI review requested due to automatic review settings May 21, 2026 08:36
@netlify
Copy link
Copy Markdown

netlify Bot commented May 21, 2026

Deploy Preview for devfra ready!

Name Link
🔨 Latest commit df53d79
🔍 Latest deploy log https://app.netlify.com/projects/devfra/deploys/6a0ec4233ce5ab0008b3d76a
😎 Deploy Preview https://deploy-preview-21--devfra.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@antfu antfu merged commit 1141007 into main May 21, 2026
12 of 13 checks passed
@antfu antfu deleted the antfu/update-docs branch May 21, 2026 08:39
@antfu antfu review requested due to automatic review settings May 21, 2026 08:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant